Completed
Push — master ( c38c9f...6d2c0d )
by Josh
06:54
created

TalentCloudAPI.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 1
rs 10
c 0
b 0
f 0
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
7
var TalentCloudAPI = {};
8
var siteContent;
9
var href;
10
TalentCloudAPI.roles = {jobseeker: "jobseeker", manager: "manager", admin: "administrator"};
11
12
TalentCloudAPI.pages = {
13
    home: {
14
        url: "#",
15
        state: function () {
16
            TalentCloudAPI.loadPublic();
17
            TalentCloudAPI.setNav("navigationHomeLinkWrapper");
18
        }
19
    },
20
    adminhome: {
21
        url: "#",
22
        state: function () {
23
            TalentCloudAPI.loadAdmin();
24
            TalentCloudAPI.setNav("navigationHomeLinkWrapper");
25
        }
26
    },
27
    AdminDashboard: {
28
        url: "#AdminDashboard",
29
        state: function () {
30
            AdminDashboardAPI.showDashboard();
0 ignored issues
show
Bug introduced by
The variable AdminDashboardAPI seems to be never declared. If this is a global, consider adding a /** global: AdminDashboardAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
31
            TalentCloudAPI.setNav("navigationAdminDashboardLink");
32
33
        }
34
    },
35
    ViewApplication: {
36
        url: "#ViewApplication",
37
        state: function (data) {
38
            JobApplicationPreviewAPI.showJobApplicationPreviewById(data);
0 ignored issues
show
Bug introduced by
The variable JobApplicationPreviewAPI seems to be never declared. If this is a global, consider adding a /** global: JobApplicationPreviewAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
39
            TalentCloudAPI.setNav("navigationAdminDashboardLink");
40
        }
41
    },
42
    ViewApplicationProfile: {
43
        url: "#ViewApplicationProfile",
44
        state: function (data) {
45
            AdminDashboardAPI.showProfileForApplication(data);
0 ignored issues
show
Bug introduced by
The variable AdminDashboardAPI seems to be never declared. If this is a global, consider adding a /** global: AdminDashboardAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
46
            TalentCloudAPI.setNav("navigationAdminDashboardLink");
47
        }
48
    },
49
    BrowseJobs: {
50
        url: "#BrowseJobs",
51
        state: function () {
52
            JobPostAPI.showBrowseJobs();
0 ignored issues
show
Bug introduced by
The variable JobPostAPI seems to be never declared. If this is a global, consider adding a /** global: JobPostAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
53
            TalentCloudAPI.setNav("navigationBrowseLinkWrapper");
54
            AccessibilityAPI.focusElement("topPage");
0 ignored issues
show
Bug introduced by
The variable AccessibilityAPI seems to be never declared. If this is a global, consider adding a /** global: AccessibilityAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
55
        }
56
    },
57
    Login: {
58
        url: "#Login",
59
        state: function () {
60
            TalentCloudAPI.setNav("navigationLoginLinkWrapper");
61
            var login = document.getElementById("navigationLoginLinkWrapper");
62
            if (login) {
63
                login.click();
64
            }
65
        }
66
    },
67
    Register: {
68
        url: "#Register",
69
        state: function () {
70
            //UserAPI.showRegisterForm();
71
            document.getElementById("navigationRegisterLinkWrapper");
72
            var registerLink = document.getElementById("navigationRegisterLink");
73
            if (registerLink) {
74
                registerLink.click();
75
            }
76
        }
77
    },
78
    MyProfile: {
79
        url: "#MyProfile",
80
        state: function () {
81
            JobSeekerAPI.showMyJobSeekerProfile();
0 ignored issues
show
Bug introduced by
The variable JobSeekerAPI seems to be never declared. If this is a global, consider adding a /** global: JobSeekerAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
82
            TalentCloudAPI.setNav("navigationProfileLinkWrapper");
83
            AccessibilityAPI.focusElement("applicantProfilePic");
0 ignored issues
show
Bug introduced by
The variable AccessibilityAPI seems to be never declared. If this is a global, consider adding a /** global: AccessibilityAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
84
        }
85
    },
86
    Job: {
87
        url: "#Job",
88
        state: function (jobPostId) {
89
            JobPostAPI.viewJobPoster(jobPostId);
0 ignored issues
show
Bug introduced by
The variable JobPostAPI seems to be never declared. If this is a global, consider adding a /** global: JobPostAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
90
            TalentCloudAPI.setNav("navigationBrowseLinkWrapper");
91
        }
92
    },
93
    CreateEditProfile: {
94
        url: "#CreateEditProfile",
95
        state: function () {
96
            CreateEditProfileAPI.showCreateEditProfile();
0 ignored issues
show
Bug introduced by
The variable CreateEditProfileAPI seems to be never declared. If this is a global, consider adding a /** global: CreateEditProfileAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
97
            TalentCloudAPI.setNav("navigationProfileLinkWrapper");
98
        }
99
    },
100
    Dashboard: {
101
        url: "#Dashboard",
102
        state: function () {
103
            DashboardAPI.showDashboard();
0 ignored issues
show
Bug introduced by
The variable DashboardAPI seems to be never declared. If this is a global, consider adding a /** global: DashboardAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
104
            TalentCloudAPI.setNav("navigationDashboardLinkWrapper");
105
        }
106
    },
107
    CreateJobPoster: {
108
        url: "#CreateJobPoster",
109
        state: function () {
110
            CreateJobPosterAPI.showCreateJobPosterForm();
0 ignored issues
show
Bug introduced by
The variable CreateJobPosterAPI seems to be never declared. If this is a global, consider adding a /** global: CreateJobPosterAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
111
            TalentCloudAPI.setNav("navigationPosterLinkWrapper");
112
        }
113
    },
114
    ManagerProfile: {
115
        url: "#ManagerProfile",
116
        state: function (managerProfileId) {
117
            ManagerProfileAPI.showManagerProfile(managerProfileId);
0 ignored issues
show
Bug introduced by
The variable ManagerProfileAPI seems to be never declared. If this is a global, consider adding a /** global: ManagerProfileAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
118
        }
119
    },
120
    JobApplication: {
121
        url: "#JobApplication",
122
        state: function (jobPosterId) {
123
            JobApplicationAPI.showCreateJobApplication(jobPosterId);
0 ignored issues
show
Bug introduced by
The variable JobApplicationAPI seems to be never declared. If this is a global, consider adding a /** global: JobApplicationAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
124
            TalentCloudAPI.setNav("navigationBrowseLinkWrapper");
125
        }
126
    },
127
    JobApplicationPreview: {
128
        url: "#JobApplicationPreview",
129
        state: function (jobApplicationId) {
130
            JobApplicationPreviewAPI.showJobApplicationPreviewById(jobApplicationId);
0 ignored issues
show
Bug introduced by
The variable JobApplicationPreviewAPI seems to be never declared. If this is a global, consider adding a /** global: JobApplicationPreviewAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
131
            TalentCloudAPI.setNav("navigationBrowseLinkWrapper");
132
        }
133
    },
134
    FAQ: {
135
        url: "#FAQ",
136
        state: function (anchor) {
137
            FAQAPI.showFAQ(anchor);
0 ignored issues
show
Bug introduced by
The variable FAQAPI seems to be never declared. If this is a global, consider adding a /** global: FAQAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
138
            // TalentCloudAPI.setNav("navigationBrowseLinkWrapper");
139
        }
140
    }
141
};
142
143
/**
144
 *
145
 * @returns {undefined}
146
 */
147
TalentCloudAPI.load = function () {
148
    var pageToReload;
149
    var stateInfo = {pageInfo: 'talent_cloud', pageTitle: 'Talent Cloud'};
150
    var managerView = false;
0 ignored issues
show
Unused Code introduced by
The variable managerView seems to be never used. Consider removing it.
Loading history...
151
    var adminView = false;
0 ignored issues
show
Unused Code introduced by
The assignment to variable adminView seems to be never used. Consider removing it.
Loading history...
152
    var location = document.location.hash;
153
    //console.log(location);
154
    //event.preventDefault();
155
    var location_elements = location.split('\/');
156
    // alert(location_elements);
157
    //console.log(location_elements[0]);
158
    var data = location_elements[1];
159
    //console.log(window.location.href.indexOf("/"+TalentCloudAPI.roles.admin));
160
    if (window.location.href.indexOf("/admin") > -1) {
161
        adminView = true;
162
        if (location_elements[0] !== "") {
163
            pageToReload = TalentCloudAPI.pages[location_elements[0].substring(1, location_elements[0].length)]
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
164
        } else {
165
            pageToReload = TalentCloudAPI.pages["adminhome"];
0 ignored issues
show
Coding Style introduced by
['adminhome'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
166
        }
167
        TalentCloudAPI.loadAdmin();
168
        console.log(adminView);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
169
        if (pageToReload !== undefined) {
170
            pageToReload.state(data);
171
        } else {
172
            window.history.replaceState(stateInfo, stateInfo.pageInfo, "/admin/#");
173
        }
174
    } else {
175
        TalentCloudAPI.loadPublic();
176
        if (location_elements[0] !== "") {
177
            pageToReload = TalentCloudAPI.pages[location_elements[0].substring(1, location_elements[0].length)]
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
178
        } else {
179
            pageToReload = TalentCloudAPI.pages["home"];
0 ignored issues
show
Coding Style introduced by
['home'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
180
        }
181
        if (pageToReload !== undefined) {
182
            pageToReload.state(data);
183
        } else {
184
            window.history.replaceState(stateInfo, stateInfo.pageInfo, "/#");
185
        }
186
    }
187
    /*if(window.location.href.indexOf("/"+TalentCloudAPI.roles.manager) > -1) {
188
189
     managerView = true;
190
     TalentCloudAPI.loadManager();
191
     if(pageToReload !== undefined){
192
     pageToReload.state(data);
193
     }else{
194
     window.history.replaceState(stateInfo, stateInfo.pageInfo, "/manager/#");
195
     }
196
     }*/
197
198
};
199
200
/**
201
 *
202
 * @returns {undefined}
203
 */
204
TalentCloudAPI.loadPublic = function () {
205
206
    if (TalentCloudAPI.getLanguageFromCookie() !== undefined) {
207
        locale = TalentCloudAPI.getLanguageFromCookie();
0 ignored issues
show
Bug introduced by
The variable locale seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.locale.
Loading history...
208
    } else {
209
        locale = "en_CA";
210
        TalentCloudAPI.setLanguageCookie(locale);
211
    }
212
    LookupAPI.loadLookupData();
0 ignored issues
show
Bug introduced by
The variable LookupAPI seems to be never declared. If this is a global, consider adding a /** global: LookupAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
213
    DataAPI.getStaticContent(locale, function (request) {
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
214
        if (request.status === 200) {
215
            var content = JSON.parse(request.response);
216
            TalentCloudAPI.setContent(content.content, false);
217
        } else {
218
            window.alert("Unable to load site content.");
219
        }
220
    });
221
222
    //Check if user is logged in with proper user role
223
    if (UserAPI.hasSessionUser()
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
224
            && UserAPI.getSessionUserAsJSON().user_role ===
0 ignored issues
show
Bug introduced by
There seems to be a bad line break before &&.
Loading history...
225
            TalentCloudAPI.roles.jobseeker) {
226
        //If logged in, adjust visible nav items
227
        var loggedIn = document.getElementById("navigationLogoutLinkWrapper");
228
        loggedIn.classList.remove("hidden");
229
230
        var loggedOut = document.getElementById("navigationLoginLinkWrapper");
231
        loggedOut.classList.add("hidden");
232
233
        var registerLink = document.getElementById("navigationRegisterLinkWrapper");
234
        registerLink.classList.add("hidden");
235
236
        var myProfileLink = document.getElementById("navigationProfileLinkWrapper");
237
        myProfileLink.classList.remove("hidden");
238
        myProfileLink.setAttribute("aria-hidden", "false");
239
240
        //jobseeker specifc items
241
        var dashBoardLink = document.getElementById("navigationDashboardLinkWrapper");
242
        dashBoardLink.classList.remove("hidden");
243
        //TODO: is there a reason this has aria-hidden and others don't?
244
        dashBoardLink.setAttribute("aria-hidden", "false");
245
    }
246
};
247
248
249
250
/**
251
 *
252
 * @returns {undefined}
253
 */
254
TalentCloudAPI.loadAdmin = function () {
255
256
    if (TalentCloudAPI.getLanguageFromCookie() !== undefined) {
257
        locale = TalentCloudAPI.getLanguageFromCookie();
0 ignored issues
show
Bug introduced by
The variable locale seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.locale.
Loading history...
258
    } else {
259
        locale = "en_CA";
260
    }
261
    LookupAPI.loadLookupData();
0 ignored issues
show
Bug introduced by
The variable LookupAPI seems to be never declared. If this is a global, consider adding a /** global: LookupAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
262
    DataAPI.getStaticContent(locale, function (request) {
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
263
        if (request.status === 200) {
264
            var content = JSON.parse(request.response);
265
            TalentCloudAPI.setContent(content.content, true);
266
        } else {
267
            window.alert("Unable to load site content.");
268
        }
269
    });
270
271
    //Check if user is logged in with proper user role
272
    if (UserAPI.hasSessionUser()
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
273
            && UserAPI.getSessionUserAsJSON().user_role ===
0 ignored issues
show
Bug introduced by
There seems to be a bad line break before &&.
Loading history...
274
            TalentCloudAPI.roles.admin) {
275
        //If logged in, adjust visible nav items
276
        var loggedIn = document.getElementById("navigationLogoutLinkWrapper");
277
        loggedIn.classList.remove("hidden");
278
279
        var loggedOut = document.getElementById("navigationLoginLinkWrapper");
280
        loggedOut.classList.add("hidden");
281
282
        var registerLink = document.getElementById("navigationRegisterLinkWrapper");
283
        registerLink.classList.add("hidden");
284
285
        var myProfileLink = document.getElementById("navigationProfileLinkWrapper");
286
        myProfileLink.classList.remove("hidden");
287
        myProfileLink.setAttribute("aria-hidden", "false");
288
289
        //admin specific items
290
291
        var adminDashBoardLink = document.getElementById("navigationAdminDashboardLinkWrapper");
292
        adminDashBoardLink.classList.remove("hidden");
293
        //TODO: is there a reason this has aria-hidden and others don't?
294
        adminDashBoardLink.setAttribute("aria-hidden", "false");
295
296
        var jobPostersLink = document.getElementById("navigationPosterLinkWrapper");
297
        jobPostersLink.classList.remove("hidden");
298
        jobPostersLink.setAttribute("aria-hidden", "false");
299
    }
300
};
301
302
/**
303
 *
304
 * @param {type} locale
305
 * @returns {undefined}
306
 */
307
TalentCloudAPI.setLanguageCookie = function (locale) {
308
    var name = "locale";
309
    var currentDate = new Date();
310
    currentDate = Utilities.addDays(currentDate, 1);
0 ignored issues
show
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
311
    var path = "/";
312
313
    Utilities.debug ? console.log("cookieDateString=" + currentDate) : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
314
    Utilities.setCookie(name, locale, currentDate, path);
315
};
316
317
/**
318
 *
319
 * @returns {unresolved}
320
 */
321
TalentCloudAPI.getLanguageFromCookie = function () {
322
    var localeCookie = Utilities.getCookieByName("locale");
0 ignored issues
show
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
323
    Utilities.debug ? console.log("localeCookie=" + localeCookie) : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
324
    return localeCookie;
325
};
326
327
/**
328
 *
329
 * @param {type} locale
330
 * @returns {undefined}
331
 */
332
TalentCloudAPI.setLanguage = function (locale) {
333
    var currentLocale = TalentCloudAPI.getLanguageFromCookie();
334
    if (currentLocale !== undefined) {
335
        //Utilities.debug?console.log("currentLocale=" + currentLocale):null;
336
        //var feedbackLinkFrench = document.querySelector(".alert-banner__copy--francais");
337
        //var feedbackLinkEnglish = document.querySelector(".alert-banner__copy--english");
338
339
        var skipNavTextFrench = document.querySelector(".skipNavTextFrench");
340
        var skipNavTextEnglish = document.querySelector(".skipNavTextEnglish");
341
342
        if (currentLocale === "en_CA") {
343
            currentLocale = "fr_CA";
0 ignored issues
show
Unused Code introduced by
The assignment to variable currentLocale seems to be never used. Consider removing it.
Loading history...
344
            TalentCloudAPI.setLanguageCookie("fr_CA");
345
            //document.getElementById("emailFeedback").href = "mailto:[email protected]?subject=Soumettez%20des%20Commentaires%20au%20Nuage%20de%20Talents&body=Nous%20vous%20remercions%20de%20votre%20int%C3%A9r%C3%AAt%20au%20nuage%20de%20talents!%20Votre%20disposition%20%C3%A0%20fournir%20des%0Acommentaires%20est%20tr%C3%A8s%20importante%20pour%20nous.%20Veuillez%20fournir%20le%20plus%20de%20renseignements%0Apossible%20%3A%0A%0AType%20de%20commentaires%20%3A%20%5Bp.%20ex.%2C%20suggestion%20ou%20bogue%5D%0A%0AVotre%20message%20%3A%20%5BTapez%20ici.%5D%0A%0APage%20actuelle%20%3A%20%5BHyperlien%20de%20la%20page%20ici%5D%0A%0AEncore%20une%20fois%2C%20merci!";
346
            //feedbackLinkFrench.classList.remove("hidden");
347
            //feedbackLinkEnglish.classList.add("hidden");
348
            skipNavTextFrench.classList.remove("hidden");
349
            skipNavTextEnglish.classList.add("hidden");
350
        } else {
351
            currentLocale = "en_CA";
352
            TalentCloudAPI.setLanguageCookie("en_CA");
353
            //document.getElementById("emailFeedback").href = "mailto:[email protected]?subject=Submit%20Feedback%20to%20Talent%20Cloud&body=Thanks%20for%20your%20interest%20in%20Talent%20Cloud!%20Your%20willingness%20to%20submit%20feedback%20is%20incredibly%0Aimportant%20to%20us.%20Please%20supply%20as%20much%20information%20as%20possible%3A%0A%0AType%20of%20Feedback%3A%20%5Be.g.%20Suggestion%2C%20Bug%2C%20etc.%5D%0A%0AYour%20Message%3A%20%5BType%20here.%5D%0A%0ACurrent%20Page%3A%20%5BPage%20Link%20Here%5D%0A%0AThanks%20again!";
354
            //feedbackLinkFrench.classList.add("hidden");
355
            //feedbackLinkEnglish.classList.remove("hidden");
356
            skipNavTextFrench.classList.add("hidden");
357
            skipNavTextEnglish.classList.remove("hidden");
358
        }
359
    } else {
360
        TalentCloudAPI.setLanguageCookie(locale);
361
    }
362
    TalentCloudAPI.load();
363
};
364
365
/**
366
 * Hides all overlays/dialogs and all main sections
367
 * @returns {undefined}
368
 */
369
TalentCloudAPI.hideAllContent = function () {
370
    var overlays = document.getElementById("overlays").children;
371
    var sections = document.getElementsByTagName("main")[0].children;
372
373
374
    for (var i = 0; i < overlays.length; i++) {
375
        overlays[i].classList.add("hidden");
376
    }
377
378
    for (var i = 0; i < sections.length; i++) {
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable i already seems to be declared on line 374. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Bug introduced by
It seems like i was already defined.
Loading history...
379
        sections[i].classList.add("hidden");
380
    }
381
};
382
383
/**
384
 * Hides the circular GC Talent Cloud logo
385
 * @returns {undefined}
386
 */
387
TalentCloudAPI.hideLogo = function () {
388
    var logo = document.getElementById("logo-container");
389
    logo.classList.add("hidden");
390
};
391
392
TalentCloudAPI.Content = function (response) {
393
    var data = JSON.parse(response);
394
    var content = data.content;
395
396
    // Navigation Links
397
    this.navigationLoginLink = content.navigationLoginLink;
398
    this.navigationLogoutLink = content.navigationLogoutLink;
399
    this.navigationRegisterLink = content.navigationRegisterLink;
400
    this.navigationHomeLink = content.navigationHomeLink;
401
    this.navigationProfileLink = content.navigationProfileLink;
402
    this.navigationBrowseLink = content.navigationBrowseLink;
403
    this.navigationDashboardLink = content.navigationDashboardLink;
404
    this.navigationPosterLink = content.navigationPosterLink;
405
    // Subpage Titles
406
    this.browseHeroTitle = content.browseHeroTitle;
407
    this.dashboardHeroTitle = content.dashboardHeroTitle;
408
    this.profileHeroTitle = content.profileHeroTitle;
409
    this.applicationHeroTitle = content.applicationHeroTitle;
410
    this.managerProfileHeroTitle = content.managerProfileHeroTitle;
411
    this.posterHeroTitle = content.posterHeroTitle;
412
    this.faqHeroTitle = content.faqHeroTitle;
413
    // Job Poster Content
414
    this.jobPosterSubnavLabel = content.jobPosterSubnavLabel;
415
    this.jobPosterSubnavItemBasics = content.jobPosterSubnavItemBasics;
416
    this.jobPosterSubnavItemImpact = content.jobPosterSubnavItemImpact;
417
    this.jobPosterSubnavItemWork = content.jobPosterSubnavItemWork;
418
    this.jobPosterSubnavItemCriteria = content.jobPosterSubnavItemCriteria;
419
    this.jobPosterSubnavItemCulture = content.jobPosterSubnavItemCulture;
420
    this.jobPosterSubnavItemKnow = content.jobPosterSubnavItemKnow;
421
    this.jobPosterSubnavItemApply = content.jobPosterSubnavItemApply;
422
    this.jobPosterContentTitleBasics = content.jobPosterContentTitleBasics;
423
    this.jobPosterContentTitleImpact = content.jobPosterContentTitleImpact;
424
    this.jobPosterContentTitleWork = content.jobPosterContentTitleWork;
425
    this.jobPosterContentTitleCriteria = content.jobPosterContentTitleCriteria;
426
    this.jobPosterContentTitleCulture = content.jobPosterContentTitleCulture;
427
    this.jobPosterContentTitleKnow = content.jobPosterContentTitleKnow;
428
    this.jobPosterContentTitleApply = content.jobPosterContentTitleApply;
429
    this.jobPosterTimeRemaining = content.jobPosterTimeRemaining;
430
    // Job Application
431
    this.essentialCriteria = content.essentialCriteria;
432
    this.assetCriteria = content.assetCriteria;
433
    this.microReference = content.microReference;
434
    this.skillSample = content.skillSample;
435
    this.applicationPositionLabel = content.applicationPositionLabel;
436
437
    // Evidence - QF
438
    this.applicantionProgressInformationAssessment = content.applicantionProgressInformationAssessment;
439
    this.applicationEvidenceExpertiseItemLabel = content.applicationEvidenceExpertiseItemLabel;
440
    this.applicationProgressMyYearsOfExperience = content.applicationProgressMyYearsOfExperience;
441
442
    // Job Application Progress Tracking - QF
443
    this.applicationProgressMyInformation = content.applicationProgressMyInformation;
444
    this.applicationProgressEssentialCriteria = content.applicationProgressEssentialCriteria;
445
    this.applicationProgressNonEssentialCriteria = content.applicationProgressNonEssentialCriteria;
446
    this.applicationProgressReviewMyApplication = content.applicationProgressReviewMyApplication;
447
448
    // Application Preview
449
    this.editApplication = content.editApplication;
450
    this.applicationPreviewProfilePhotoTitle = content.applicationPreviewProfilePhotoTitle;
451
    this.applicationPreviewProfileAlert = content.applicationPreviewProfileAlert;
452
    this.applicationPreviewDeclarationStoryTitle = content.applicationPreviewDeclarationStoryTitle;
453
    this.applicationPreviewMicroReferenceTitle = content.applicationPreviewMicroReferenceTitle;
454
    this.applicationPreviewReferenceMissing = content.applicationPreviewReferenceMissing;
455
    this.applicationPreviewSkillSampleStoryLabel = content.applicationPreviewSkillSampleStoryLabel;
456
    this.applicationPreviewSkillSampleLink = content.applicationPreviewSkillSampleLink;
457
    this.applicationPreviewSkillSampleMissing = content.applicationPreviewSkillSampleMissing;
458
459
    // Others
460
    this.title = content.title;
461
    this.helpLearn = content.helpLearn;
462
    this.languageSelect = content.languageSelect;
463
    this.applyNow = content.applyNow;
464
    this.jobPostersLink = content.jobPostersLink;
465
    this.teamsLink = content.teamsLink;
466
    this.jobNumber = content.jobNumber;
467
    this.jobTitle = content.jobTitle;
468
    this.jobLocation = content.jobLocation;
469
    this.jobCity = content.jobCity;
470
    this.jobProvince = content.jobProvince;
471
    this.jobApplicantsSoFar = content.jobApplicantsSoFar;
472
    this.jobUnitsToCloseHours = content.jobUnitsToCloseHours;
473
    this.jobUnitsToCloseDays = content.jobUnitsToCloseDays;
474
    this.jobUnitsToCloseMonths = content.jobUnitsToCloseMonths;
475
    this.jobUntilClose = content.jobUntilClose;
476
    this.jobTerm = content.jobTerm;
477
    this.viewButton = content.viewButton;
478
    this.jobSalaryRange = content.jobSalaryRange;
479
    this.submitApplication = content.submitApplication;
480
    this.step1 = content.step1;
481
    this.step2 = content.step2;
482
    this.step3 = content.step3;
483
    this.review = content.review;
484
    this.goToStep2 = content.goToStep2;
485
    this.goToStep1 = content.goToStep1;
486
    this.goToStep3 = content.goToStep3;
487
    this.goToReview = content.goToReview;
488
    this.createJobPosterWindowTitle = content.createJobPosterWindowTitle;
489
    this.createProfileWindowTitle = content.createProfileWindowTitle;
490
    this.required = content.required;
491
    this.submit = content.submit;
492
    this.generalInformation = content.generalInformation;
493
    this.aboutMe = content.aboutMe;
494
    this.aLittleBitAboutMe = content.aLittleBitAboutMe;
495
    this.whatImMostProudOfInCareer = content.whatImMostProudOfInCareer;
496
    this.position = content.position;
497
    this.department = content.department;
498
    this.branch = content.branch;
499
    this.division = content.division;
500
    this.leadershipStyle = content.leadershipStyle;
501
    this.myLeadershipStyle = content.myLeadershipStyle;
502
    this.myApproachToEmployee = content.myApproachToEmployee;
503
    this.myExpectationsOfEmployees = content.myExpectationsOfEmployees;
504
    this.myApproachToDecisionMaking = content.myApproachToDecisionMaking;
505
    this.workExperience = content.workExperience;
506
    this.education = content.education;
507
    this.howOftenDoYouReview = content.howOftenDoYouReview;
508
    this.howOftenDoYouStayLate = content.howOftenDoYouStayLate;
509
    this.howOftenDoYouEngage = content.howOftenDoYouEngage;
510
    this.howOftenDoYouApproveDevelopment = content.howOftenDoYouApproveDevelopment;
511
    this.almostNever = content.almostNever;
512
    this.rarely = content.rarely;
513
    this.sometimes = content.sometimes;
514
    this.usually = content.usually;
515
    this.almostAlways = content.almostAlways;
516
    this.name = content.name;
517
    this.gctc = content.gctc;
518
    this.at = content.at;
519
    this.readMore = content.readMore;
520
    this.canadaLink = content.canadaLink;
521
    this.canadaLinkHref = content.canadaLinkHref;
522
    this.taglineMain = content.taglineMain;
523
    this.taglineSecondary = content.taglineSecondary;
524
    this.taglineTertiary = content.taglineTertiary;
525
    this.howItWorksHeading = content.howItWorksHeading;
526
    this.howItWorksLead = content.howItWorksLead;
527
    this.logoSrc = content.logoSrc;
528
    this.ownYourStory = content.ownYourStory;
529
    this.ownYourStoryText = content.ownYourStoryText;
530
    this.getFound = content.getFound;
531
    this.getFoundText = content.getFoundText;
532
    this.contribute = content.contribute;
533
    this.contributeText = content.contributeText;
534
    this.howItWorksLeadOut = content.howItWorksLeadOut;
535
    this.howItWorksLast = content.howItWorksLast;
536
    this.contactUs = content.contactUs;
537
    this.transcript = content.transcript;
538
    this.ourTeam = content.ourTeam;
539
    this.ourTeamText = content.ourTeamText;
540
    this.browseTitle = content.browseTitle;
541
    this.createJobApplicationWindowTitle = content.createJobApplicationWindowTitle;
542
    this.createJobApplicationJobTitleLabel = content.createJobApplicationJobTitleLabel;
543
    this.createJobApplicationConfirmationPositionLabel = content.createJobApplicationConfirmationPositionLabel;
544
    this.jobApplicationConfirmationTrackingReminder = content.jobApplicationConfirmationTrackingReminder;
545
    this.continueToDashboard = content.continueToDashboard;
546
    this.announcement = content.announcement;
547
    this.adminPortal = content.adminPortal;
548
    this.applicantPortal = content.applicantPortal;
549
    this.yourApplicationsTitle = content.yourApplicationsTitle;
550
    this.workEnvironment = content.workEnvironment;
551
    this.remoteLocationAllowed = content.remoteLocationAllowed;
552
    this.teleworkAllowed = content.teleworkAllowed;
553
    this.flexHoursAllowed = content.flexHoursAllowed;
554
    this.yes = content.yes;
555
    this.no = content.no;
556
    this.physicalEnvironment = content.physicalEnvironment;
557
    this.teamCulture = content.teamCulture;
558
    this.teamSize = content.teamSize;
559
    this.gcDirectoryLink = content.gcDirectoryLink;
560
    this.teamSizePrompt = content.teamSizePrompt;
561
    this.gcDirectoryLinkPrompt = content.gcDirectoryLinkPrompt;
562
    this.teamNarrativePrompt = content.teamNarrativePrompt;
563
    this.adminTagline = content.adminTagline;
564
    this.adminAboutMe = content.adminAboutMe;
565
    this.adminProfilePositionLabel = content.adminProfilePositionLabel;
566
    this.adminProfileDepartmentLabel = content.adminProfileDepartmentLabel;
567
    this.adminProfileBranchLabel = content.adminProfileBranchLabel;
568
    this.jobReferenceId = content.jobReferenceId;
569
    this.openEndedQuestions = content.openEndedQuestions;
570
    this.skipNavText = content.skipNavtext;
571
    this.managerProfile_review_option0 = content.managerProfile_review_option0;
572
    this.managerProfile_review_option1 = content.managerProfile_review_option1;
573
    this.managerProfile_review_option2 = content.managerProfile_review_option2;
574
    this.managerProfile_review_option3 = content.managerProfile_review_option3;
575
    this.managerProfile_review_option4 = content.managerProfile_review_option4;
576
    this.managerProfile_stayLate_option0 = content.managerProfile_stayLate_option0;
577
    this.managerProfile_stayLate_option1 = content.managerProfile_stayLate_option1;
578
    this.managerProfile_stayLate_option2 = content.managerProfile_stayLate_option2;
579
    this.managerProfile_stayLate_option3 = content.managerProfile_stayLate_option3;
580
    this.managerProfile_stayLate_option4 = content.managerProfile_stayLate_option4;
581
    this.managerProfile_engagement_option0 = content.managerProfile_engagement_option0;
582
    this.managerProfile_engagement_option1 = content.managerProfile_engagement_option1;
583
    this.managerProfile_engagement_option2 = content.managerProfile_engagement_option2;
584
    this.managerProfile_engagement_option3 = content.managerProfile_engagement_option3;
585
    this.managerProfile_engagement_option4 = content.managerProfile_engagement_option4;
586
    this.managerProfile_developmentOpportunities_option0 = content.managerProfile_developmentOpportunities_option0;
587
    this.managerProfile_developmentOpportunities_option1 = content.managerProfile_developmentOpportunities_option1;
588
    this.managerProfile_developmentOpportunities_option2 = content.managerProfile_developmentOpportunities_option2;
589
    this.managerProfile_developmentOpportunities_option3 = content.managerProfile_developmentOpportunities_option3;
590
    this.managerProfile_developmentOpportunities_option4 = content.managerProfile_developmentOpportunities_option4;
591
    this.managerProfile_acceptLowValueWorkRequests_option0 = content.managerProfile_acceptLowValueWorkRequests_option0;
592
    this.managerProfile_acceptLowValueWorkRequests_option1 = content.managerProfile_acceptLowValueWorkRequests_option1;
593
    this.managerProfile_acceptLowValueWorkRequests_option2 = content.managerProfile_acceptLowValueWorkRequests_option2;
594
    this.managerProfile_acceptLowValueWorkRequests_option3 = content.managerProfile_acceptLowValueWorkRequests_option3;
595
    this.managerProfile_acceptLowValueWorkRequests_option4 = content.managerProfile_acceptLowValueWorkRequests_option4;
596
    this.managerDecisions_tipWhatis = content.managerDecisions_tipWhatis;
597
    this.managerDecisions_tipSummary = content.managerDecisions_tipSummary;
598
    this.profileBasicInfoEditTitle = content.profileBasicInfoEditTitle;
599
    this.changeDisplayPic = content.changeDisplayPic;
600
    this.updateProfilePhotoTitle = content.updateProfilePhotoTitle;
601
    this.updateProfilePhotoDraggableAreaLabel = content.updateProfilePhotoDraggableAreaLabel;
602
    this.updateProfilePhotoDraggableAreaErrorSize = content.updateProfilePhotoDraggableAreaErrorSize;
603
    this.updateProfilePhotoDraggableAreaErrorType = content.updateProfilePhotoDraggableAreaErrorType;
604
    this.updateProfileOrCopy = content.updateProfileOrCopy;
605
    this.updateProfileChoosePhotoButtonLabelSpan = content.updateProfileChoosePhotoButtonLabelSpan;
606
    this.updateProfileChoosePhotoButton = content.updateProfileChoosePhotoButton;
607
    this.updateProfileChooseAltPhotoButtonLabelSpan = content.updateProfileChooseAltPhotoButtonLabelSpan;
608
    this.updateProfileChooseAltPhotoButton = content.updateProfileChooseAltPhotoButton;
609
    this.updateProfilePhotoCancelButton = content.updateProfilePhotoCancelButton;
610
    this.profileBasicInfoEditCancel = content.profileBasicInfoEditCancel;
611
    this.updateProfileApplicantProfileFormNameLabelSpan = content.updateProfileApplicantProfileFormNameLabelSpan;
612
    this.profileEditName = content.profileEditName;
613
    this.updateProfileApplicantProfileFormTaglineLabelSpan = content.updateProfileApplicantProfileFormTaglineLabelSpan;
614
    this.profileEditTagline = content.profileEditTagline;
615
    this.updateProfileApplicantProfileFormTwitterLabelSpan = content.updateProfileApplicantProfileFormTwitterLabelSpan;
616
    this.profileEditTwitter = content.profileEditTwitter;
617
    this.updateProfileApplicantProfileFormLinkedinLabelSpan = content.updateProfileApplicantProfileFormLinkedinLabelSpan;
618
    this.profileEditLinkedin = content.profileEditLinkedin;
619
    this.profileBasicInfoEditCancel = content.profileBasicInfoEditCancel;
620
    this.profileBasicInfoEditSave = content.profileBasicInfoEditSave;
621
    this.profilePicUploadBtn = content.profilePicUploadBtn;
622
    this.loginFormTitle = content.loginFormTitle;
623
    this.loginModalCopySpan = content.loginModalCopySpan;
624
    this.switchToRegister = content.switchToRegister;
625
    this.loginModalEmailLabelSpan = content.loginModalEmailLabelSpan;
626
    this.login_email = content.login_email;
627
    this.loginModalPasswordLabelSpan = content.loginModalPasswordLabelSpan;
628
    this.login_password = content.login_password;
629
    this.loginFormCancelBtn = content.loginFormCancelBtn;
630
    this.loginFormLoginBtn = content.loginFormLoginBtn;
631
    this.registerFormTitle = content.registerFormTitle;
632
    this.profileAboutMeEditTitle = content.profileAboutMeEditTitle;
633
    this.updateAboutTextareaLabelSpan = content.updateAboutTextareaLabelSpan;
634
    this.profileEditAboutMe = content.profileEditAboutMe;
635
    this.profileAboutMeEditCancel = content.profileAboutMeEditCancel;
636
    this.profileAboutMeEditSave = content.profileAboutMeEditSave;
637
    this.managerDecisions_tipWhatis = content.managerDecisions_tipWhatis;
638
    this.managerDecisions_tipSummary = content.managerDecisions_tipSummary;
639
    this.accommodationTextStart = content.accommodationTextStart;
640
    this.accommodationTextEnd = content.accommodationTextEnd;
641
    this.jobPosterKeyTasksLabel = content.jobPosterKeyTasksLabel;
642
    this.jobPosterCoreCompetenciesLabel = content.jobPosterCoreCompetenciesLabel;
643
    this.jobPosterDevelopingCompetenciesLabel = content.jobPosterDevelopingCompetenciesLabel;
644
    this.jobPosterHiringManagerLabel = content.jobPosterHiringManagerLabel;
645
    this.jobPosterClearanceLevelLabel = content.jobPosterClearanceLevelLabel;
646
    this.jobPosterStartDateLabel = content.jobPosterStartDateLabel;
647
    this.jobPosterJobLevelLabel = content.jobPosterJobLevelLabel;
648
    this.jobPosterLanguageLabel = content.jobPosterLanguageLabel;
649
    this.jobPosterTermLabel = content.jobPosterTermLabel;
650
    this.save = content.save;
651
    this.cancel = content.cancel;
652
    this.editYour = content.editYour;
653
    this.jobPosterTeamNarrativeText_label = content.jobPosterTeamNarrativeText_label;
654
    this.jobPosterOperatingContext_label = content.jobPosterOperatingContext_label;
655
    this.jobPosterWhatWeValue_label = content.jobPosterWhatWeValue_label;
656
    this.jobPosterHowWeWork_label = content.jobPosterHowWeWork_label;
657
    this.years = content.years;
658
    this.status = content.status;
659
    this.jobPosterBackButtonText = content.jobPosterBackButtonText;
660
    this.termsAndConditions = content.termsAndConditions;
661
    this.privacy = content.privacy;
662
    this.jobPosterApplicants = content.jobPosterApplicants;
663
};
664
665
/**
666
 *
667
 * @param {type} content
668
 * @param {type} isManager
669
 * @returns {undefined}
670
 */
671
TalentCloudAPI.setContent = function (content, isManager) {
672
673
    console.log(content);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
674
675
    siteContent = content;
676
    document.title = siteContent.title;
677
    window.title = siteContent.title;
678
679
    var logoSource = document.getElementById("logoSrc");
680
    logoSource.src = siteContent.logoSrc;
681
682
    for (var i = 0; i < Object.keys(siteContent).length; i++) {
683
        var key = Object.keys(siteContent)[i];
684
        var value = siteContent[key];
685
        //Seach for id matching the base_content key
686
        var element = document.getElementById(key);
687
        if (element) {
688
            element.innerHTML = value;
689
        }
690
        var selector = "." + key; //Search for classes matching the base_content key
691
        var classElements = document.querySelectorAll(selector);
692
        for (var j = 0; j < classElements.length; j++) {
693
            classElements[j].innerHTML = value;
694
            classElements[j].placeholder = value;
695
        }
696
    }
697
698
699
    if (isManager) {
700
701
        //console.log(isManager);
702
703
704
        //TODO: make sure spreadsheet and loop replace this functionality
705
        //CreateWorkEnvironmentAPI.localizeCreateWorkEnvironment();
706
        //EditTeamCultureAPI.localizeEditTeamCulture();
707
        CreateJobPosterAPI.localizeCreateJobPosterForm(siteContent);
0 ignored issues
show
Bug introduced by
The variable CreateJobPosterAPI seems to be never declared. If this is a global, consider adding a /** global: CreateJobPosterAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
708
        CreateEditProfileAPI.localizeCreateEditProfile(siteContent);
0 ignored issues
show
Bug introduced by
The variable CreateEditProfileAPI seems to be never declared. If this is a global, consider adding a /** global: CreateEditProfileAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
709
710
        try {
0 ignored issues
show
Comprehensibility Documentation Best Practice introduced by
This code block is empty. Consider removing it or adding a comment to explain.
Loading history...
Unused Code introduced by
Empty try statement found. This statement can be removed.
Loading history...
711
712
        } catch (e) {
0 ignored issues
show
introduced by
This code is unreachable and can thus be removed without consequences.
Loading history...
713
            (console.error || console.log).call(console, e.stack || e);
714
        }
715
    }
716
717
};
718
719
TalentCloudAPI.setNav = function (navItemToHighlightId) {
720
    var navItems = document.querySelectorAll(".page-hero__navigation-item"), i;
721
    for (i = 0; i < navItems.length; ++i) {
722
        navItems[i].classList.remove("active");
723
    }
724
    var navItemToHighlight = document.getElementById(navItemToHighlightId);
725
    navItemToHighlight.classList.add("active");
726
    var mobileMenuTrigger = document.getElementById("pageHeroMobileTrigger");
727
    var mainMenu = document.getElementById("pageHeroNavigationMenu");
728
    mobileMenuTrigger.classList.remove("active");
729
    mainMenu.classList.remove("active");
730
731
    // Set scroll / focus to top of page
732
    window.scrollTo(0,0);
733
    AccessibilityAPI.focusElement("topPage");
0 ignored issues
show
Bug introduced by
The variable AccessibilityAPI seems to be never declared. If this is a global, consider adding a /** global: AccessibilityAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
734
    document.getElementById("topPage").focus();
735
};
736